package com.imooc.controller;

import com.imooc.service.StuService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

//@ApiIgnore
@RestController
@AllArgsConstructor
public class StuFooController {


  private final StuService stuService;

  @GetMapping("/getStu/{id}")
  public Object getStu(@PathVariable int id) {
    return stuService.getStuInfo(id);
  }

  @PostMapping("/saveStu")
  public Object saveStu() {
    stuService.saveStu();
    return "OK";
  }

  @PostMapping("/updateStu")
  public Object updateStu(int id) {
    stuService.updateStu(id);
    return "OK";
  }

  @PostMapping("/deleteStu")
  public Object deleteStu(int id) {
    stuService.deleteStu(id);
    return "OK";
  }

}
